﻿namespace HuaWei.Search
{
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Grid;
    using HuaWei.BusinessRule;
    using HuaWei.CommClass;
    using HuaWei.DAI;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmSearchJLHZ : Form
    {
        private BindingSource bindingSource;
        private CBaseRule cbaseRule;
        private GridColumn gridColumn1;
        private GridColumn gridColumn2;
        private GridColumn gridColumn3;
        private GridColumn gridColumn5;
        private GridControl gridControl1;
        private GridView gridView1;
        private IContainer icontainer = null;
        private IDataAccess lquywmUul;
        public string OldBDID = "";

        public FrmSearchJLHZ()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.icontainer != null))
            {
                this.icontainer.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmSearchJLHZ_Load(object sender, EventArgs e)
        {
            this.cbaseRule = new CBaseRule();
            this.lquywmUul = this.cbaseRule.GetDataAccess();
            this.method();
        }

        private void InitializeComponent()
        {
            this.icontainer = new Container();
            this.gridControl1 = new GridControl();
            this.bindingSource = new BindingSource(this.icontainer);
            this.gridView1 = new GridView();
            this.gridColumn1 = new GridColumn();
            this.gridColumn2 = new GridColumn();
            this.gridColumn3 = new GridColumn();
            this.gridColumn5 = new GridColumn();
            this.gridControl1.BeginInit();
            ((ISupportInitialize) this.bindingSource).BeginInit();
            this.gridView1.BeginInit();
            base.SuspendLayout();
            this.gridControl1.DataSource = this.bindingSource;
            this.gridControl1.Dock = DockStyle.Fill;
            this.gridControl1.Location = new Point(0, 0);
            this.gridControl1.MainView = this.gridView1;
            this.gridControl1.Name = "gridControl1";
            this.gridControl1.Size = new Size(0x2e3, 360);
            this.gridControl1.TabIndex = 1;
            this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.gridView1 });
            this.gridView1.Columns.AddRange(new GridColumn[] { this.gridColumn1, this.gridColumn2, this.gridColumn3, this.gridColumn5 });
            this.gridView1.GridControl = this.gridControl1;
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsBehavior.ReadOnly = true;
            this.gridView1.OptionsCustomization.AllowFilter = false;
            this.gridView1.OptionsCustomization.AllowGroup = false;
            this.gridView1.OptionsCustomization.AllowSort = false;
            this.gridView1.OptionsView.ColumnAutoWidth = false;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridColumn1.Caption = "机构名称";
            this.gridColumn1.FieldName = "MC";
            this.gridColumn1.Name = "gridColumn1";
            this.gridColumn1.Visible = true;
            this.gridColumn1.VisibleIndex = 0;
            this.gridColumn1.Width = 0xf6;
            this.gridColumn2.Caption = "计量金额";
            this.gridColumn2.FieldName = "jlje";
            this.gridColumn2.Name = "gridColumn2";
            this.gridColumn2.Visible = true;
            this.gridColumn2.VisibleIndex = 1;
            this.gridColumn2.Width = 0x56;
            this.gridColumn3.Caption = "变更计量金额";
            this.gridColumn3.FieldName = "bgje";
            this.gridColumn3.Name = "gridColumn3";
            this.gridColumn3.Visible = true;
            this.gridColumn3.VisibleIndex = 2;
            this.gridColumn3.Width = 0x54;
            this.gridColumn5.Caption = "合计";
            this.gridColumn5.FieldName = "hzje";
            this.gridColumn5.Name = "gridColumn5";
            this.gridColumn5.Visible = true;
            this.gridColumn5.VisibleIndex = 3;
            this.gridColumn5.Width = 0x7a;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize = new Size(0x2e3, 360);
            base.Controls.Add(this.gridControl1);
            base.Name = "FrmSearchJLHZ";
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "各机构计量汇总查询";
            base.Load += new EventHandler(this.FrmSearchJLHZ_Load);
            this.gridControl1.EndInit();
            ((ISupportInitialize) this.bindingSource).EndInit();
            this.gridView1.EndInit();
            base.ResumeLayout(false);
        }

        private void method()
        {
            if (!this.OldBDID.Equals(GParams._BDID))
            {
                this.OldBDID = GParams._BDID;
                string sql = "";
                if (GParams.QCInfo.QCZT.Equals(1))
                {
                    sql = string.Format(CSearchSQL.SEARCH_JLHZ_YZ, GParams._BDID, GParams.QCInfo.QCID);
                }
                else
                {
                    sql = string.Format(CSearchSQL.SEARCH_JLHZ, GParams._BDID, GParams.QCInfo.QCID, GParams.LoginId);
                }
                DataTable dt = DBHelp.GetDt(CHelp.smethod(sql), "JLHZ");
                this.bindingSource.DataSource = dt;
            }
        }
    }
}

